home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / bin / debconf < prev    next >
Encoding:
Text File  |  2011-01-30  |  2.8 KB  |  121 lines

  1. #!/usr/bin/perl -w
  2.  
  3. =head1 NAME
  4.  
  5. debconf - run a debconf-using program
  6.  
  7. =cut
  8.  
  9. =head1 SYNOPSIS
  10.  
  11.  debconf [options] command [args]
  12.  
  13. =head1 DESCRIPTION
  14.  
  15. Debconf is a configuration system for Debian packages. For a debconf
  16. overview and documentation for sysadmins, see L<debconf(7)> (in the
  17. debconf-doc package).
  18.  
  19. The B<debconf> program runs a program under debconf's control, setting it up
  20. to talk with debconf on stdio. The program's output is expected to be debconf
  21. protocol commands, and it is expected to read result codes on stdin. See
  22. L<debconf-devel(7)> for details about the debconf protocol.
  23.  
  24. The command to be run under debconf must be specified in a way that will
  25. let your PATH find it.
  26.  
  27. This command is not the usual way that debconf is used. It's more typical
  28. for debconf to be used via L<dpkg-preconfigure(8)> or L<dpkg-reconfigure(8)>.
  29.  
  30. =head1 OPTIONS
  31.  
  32. =over 4
  33.  
  34. =item B<-o>I<package>, B<--owner=>I<package>
  35.  
  36. Tell debconf what package the command it is running is a part of. This is
  37. necessary to get ownership of registered questions right, and to support
  38. unregister and purge commands properly.
  39.  
  40. =item B<-f>I<type>, B<--frontend=>I<type>
  41.  
  42. Select the frontend to use.
  43.  
  44. =item B<-p>I<value>, B<--priority=>I<value>
  45.  
  46. Specify the minimum priority of question that will be displayed.
  47.  
  48. =item B<--terse>
  49.  
  50. Enables terse output mode. This affects only some frontends.
  51.  
  52. =back
  53.  
  54. =head1 EXAMPLES
  55.  
  56. To debug a shell script that uses debconf, you might use:
  57.  
  58.  DEBCONF_DEBUG=developer debconf my-shell-prog
  59.  
  60. Or, you might use this:
  61.  
  62.  debconf --frontend=readline sh -x my-shell-prog
  63.  
  64. =head1 SEE ALSO
  65.  
  66. L<debconf-devel(7)>, L<debconf(7)>
  67.  
  68. =cut
  69.  
  70. use strict;
  71. use Debconf::Db;
  72. use Debconf::AutoSelect qw(:all);
  73. use Debconf::Gettext;
  74. use Debconf::Config;
  75.  
  76. # Find the end of the options for this command, and the beginning of the
  77. # command to run, which may have arguments. Break those arguments out.
  78. my (@argv, @command);
  79. for (my $x=0; $x <= $#ARGV; $x++) {
  80.     if ($ARGV[$x] =~ /^-(o|f|p|-(owner|frontend|priority))$/) {
  81.         push @argv, $ARGV[$x++];
  82.         push @argv, $ARGV[$x] if defined $ARGV[$x]; # skip option argument
  83.         next;
  84.     }
  85.     elsif ($ARGV[$x] =~ /^-/) {
  86.         push @argv, $ARGV[$x];
  87.     }
  88.     else {
  89.         # end of arguments, start of command
  90.         @command=@ARGV[$x..$#ARGV];
  91.         last;
  92.     }
  93. }
  94. @ARGV=@argv;
  95. my $usage = gettext("Usage: debconf [options] command [args]");
  96. my $owner='';
  97. Debconf::Config->getopt($usage.gettext(qq{
  98.   -o,  --owner=package        Set the package that owns the command.}),
  99.         "o|owner=s"        => \$owner,
  100. );
  101. die "$usage\n" unless @command;
  102.  
  103. Debconf::Db->load;
  104. my $frontend=make_frontend();
  105. my $confmodule=make_confmodule(@command);
  106. $confmodule->owner($owner) if length $owner;
  107.  
  108. 1 while ($confmodule->communicate);
  109.  
  110. my $code=$confmodule->exitcode;
  111. $frontend->shutdown;
  112. $confmodule->finish;
  113. Debconf::Db->save;
  114. exit $code;
  115.  
  116. =head1 AUTHOR
  117.  
  118. Joey Hess <joeyh@debian.org>
  119.  
  120. =cut
  121.